-# coding: utf-8
%div{align: "center"}
  %h1 Nuestra lista de productos
  - if @prods.empty?
    %p
      No hay productos en venta
  - else
    %table.table{align: "center", border: "1"}
      %tr
        %th Nombre
        %th Precio
        %th Tipo de precio
        %th Última modificación de precio
        %th Tipo
        %th Imagen
        %th
        - @prods.each do |prod|
          %tr
            %td= prod.name
            %td
              $#{prod.price}
            %td= prod.price_type
            %td= prod.mod_date.to_date
            %td= prod.type
            %td
              %img{alt: "", src: prod.image}/
            - if current_account
              %td
                %form{action: "edit", method: "get"}
                  %input{name: "name", type: "hidden", value: prod.name}/
                  %input{name: "type", type: "hidden", value: prod.type}/
                  %input.btn-primary{id: "pay_#{prod.name}_button", type: "submit", value: "EDITAR"}/
            %td
              %form{action: "delete", method: "get" , onsubmit: "return confirm('¡ATENCIÓN! ¿Realmente desea borrar este producto? La imagen del mismo será también borrada.');"}
                %input{name: "name", type: "hidden", value: prod.name}/
                %input{name: "type", type: "hidden", value: prod.type}/
                %input.btn-danger{id: "pay_#{prod.name}_button", type: "submit", value: "BORRAR"}/
  / gallery
  #image-slider
    #slide-frame
      %img{alt: "", src: "images/logoNect.png"}/
      #slides
        .img-wrap
          %img#slide1{alt: "", src: "images/logoNect.png"}/
          .img-info
            %h4 Title
            %p
              Cheesecake
            %p
              Precio: 70 chica/80 grande
            %p
              actualizacion de precio
            %a{href: "index"} Edit
        %img#slide2{alt: "", src: "images/logoNect.png"}/
    #navigation
      %a{href: "#slide1"} 1
  -if current_account
    %form.inlining{action: "/new_product", method: "get"}
      %input#addNewPaymentButton.btn{type: "submit", value: "Crear un producto nuevo"}/
    %br/
    %br/
  -if current_account
    .well
      .form-horizontal
        %form#stats.form-horizontal{action: "stats", method: "get"}
          %p
            View how many payments or incomes I did in a given period of time
          From date
          %input#from_date{name: "from_date", type: "date", value: Date.today}/
          To date
          %input#to_date{name: "to_date", type: "date", value: Date.today + 1}/
          Type
          %select#type{name: "type"}
            %option{value: "1"} Payments
            %option{value: "0"} Incomes
          %input#viewStatsButton.btn{type: "submit", value: "View stats"}/

